import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            redirect: '/BasicLayout',
        },
        {
            path: '/login',
            name: 'Login',
            meta: {
                title: '用户登录',
            },
            component: () => import('@/views/Login/index.vue'),
        },
        {
            path: '/404',
            name: '404',
            meta: {
                title: '找不到页面',
            },
            component: () => import('@/common/views/ErrorPage/index.vue'),
        },
        {
            path: '/redirect',
            component: () => import('@/layouts/BasicLayout/index.vue'),
            hidden: true,
            children: [
                {
                    meta: {
                        isRedirect: true,
                    },
                    path: '/redirect/:path(.*)',
                    component: () => import('@/common/views/Redirect/index.vue'),
                },
            ],
        },
    ],
})

export default router
